<template>
  <div id="app">
    <nav>
    <el-container>

      <el-header><span>ld.（vue+element）</span></el-header>

      <el-container>

        <el-aside width="200px">
          <el-menu
              router
              default-active="2"
              class="el-menu-vertical-demo"
              background-color="#545c64"
              text-color="#fff"
              active-text-color="#ffd04b">
            <el-submenu index="1" v-for="m in menus" :key="m.index">
              <template slot="title">
                <i :class="m.icon"></i>
                <span>{{m.title}}</span>
              </template>
              <el-menu-item :index="m.path + '/' + child.path" v-for="child in m.children" :key="child.index">
                <i :class="child.icon"></i>
                <span>{{child.title}}</span>
              </el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>

        <el-main>
          <router-view/>
        </el-main>

      </el-container>
    </el-container>
    </nav>
  </div>
</template>

<style>
*{
  padding:0;
  margin:0
}
.el-menu{
  border-right:0;
}
.el-header{
  background-color: rgb(84,92,100);
  color: white;
  text-align: right;
  line-height: 60px;
}

.el-aside {
  background-color: rgb(84,92,100);
  color: #333;
  text-align: center;
  height: 800px;
}

.el-main {
  background-color:lightblue;
  color: #333;
  text-align: center;

}
.el-menu-item{
  text-indent: 4em;;
}
</style>
<script>
import menus from "../api/menus";
export default {
  name:'app',
  data(){
    return {
      menus:menus
    }
  }
}
</script>
